//
// Created by rengen.gong on 2021/12/2.
//

#ifndef LEARN1_MYPOINT_H
#define LEARN1_MYPOINT_H
#include <iostream>
using namespace std;
class MyPoint {

public:
    MyPoint(int x = 0,int y = 0){
        X = x;
        Y = y;
        countP ++ ;
    }
    MyPoint(MyPoint &p);

//
//    //
//    MyPoint(MyPoint &p){
//        X=p.X;
//        Y=p.Y;
//        countP++;
//    }

    int GetX(){
        return X;
    }

    int GetY(){
        return Y;
    }

    void GetC(){
        cout<<" Object id="<<countP<<endl;
    }

private:
    int X,Y;
    //静态数据成员，必须在外部定义和初始化，内部不能直接初始化！
    static int countP;

};

MyPoint::MyPoint(MyPoint &p){
    X=p.X;
    Y=p.Y;
    countP++;
}

int MyPoint::countP = 100;


#endif //LEARN1_MYPOINT_H
